package zoo.cart.admin.dao;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import zoo.cart.admin.domain.AdminProductOrderCommand;
import zoo.cart.admin.domain.CartCommand;
import zoo.member.admin.pro.domain.AdminProductCommand;

public class CartDaoImpl extends SqlSessionDaoSupport implements CartDao{

	@Override
	public CartCommand selectCart(int or_num) {
		CartCommand command = (CartCommand)getSqlSession().selectOne("selectCart", or_num);
		return command;
	}

	@Override
	public int getCartRowCount(Map<String, Object> map) {
		return (Integer)getSqlSession().selectOne("selectCartCount", map);
	}

	@Override
	public List<CartCommand> cartlist(Map<String, Object> map) {
		List<CartCommand> list = getSqlSession().selectList("selectCartList",map);
		return list;
	}

	@Override
	public void checkCart(int or_num) {
		getSqlSession().update("checkCart",or_num);
	}

	@Override
	public void changePro(Map<String, Object> map) {
		getSqlSession().update("changePro",map);
	}

	@Override
	public int checkQtity(int p_code) {
		return (Integer)getSqlSession().selectOne("checkQtity", p_code);
	}

	@Override
	public void updateProQcheck(int p_code) {
		getSqlSession().update("updateProQcheck",p_code);
	}

	@Override
	public AdminProductOrderCommand selectProOrderBoard(Integer p_code) {
		AdminProductOrderCommand proCommand = (AdminProductOrderCommand)getSqlSession().selectOne("selectProOrderBoard", p_code);
		return proCommand;
	}

	@Override
	public void updateBuyNum(int p_code) {
		getSqlSession().update("updateBuyNum",p_code);
	}

}
